﻿using Cuofrisp.Core.ParallelCore.Tools;

namespace Cuofrisp.Core.ParallelCore
{
    public partial class ParallelCuofrispCalculator
    {
        private void SetMetricDerivative(CuofrispResult result)
        {
            _ = Parallel.For(0, result.MetricDerivative.Length,
                this.parallelOptions,
                (muNuRho) => {
                    var (mu, nu, rho) = muNuRho.As3dIndex(result.VariableCount);
                    result.MetricDerivative[mu, nu, rho] =
                       this.simplifier.Simplify(result.Metric[mu, nu].Differentiate(result.Variables[rho]));
                });
        }
    }
}